import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/index.vue'
import Cart from '../views/Cart/index.vue'
import Friends from '../views/Friends/index.vue'
import Search from '../views/Search/index.vue'
import NewsList from '../views/Home/news/NewsList'
import NewsInfo from '../views/Home/news/Newslnfo'

Vue.use(VueRouter)

const routes = [
  {
    // 设置初始路由 ‘/’
    path: '/',
    redirect: '/home',
    meta: {
      active: 0,
      title: 'Home'
    }
  },
  {
    path: '/home',
    component: Home,
    meta: {
      active: 0,
      title: 'Home'
    }
  },
  {
    path: '/Cart',
    component: Cart,
    meta: {
      active: 2,
      title: 'Cart'
    }
  }, {
    path: '/Friends',
    component: Friends,
    meta: {
      active: 1,
      title: 'Friends'
    }
  }, {
    path: '/Search',
    component: Search,
    meta: {
      active: 3,
      title: 'Search'
    }
  },
  {
    path: '/home/NewsList',
    component: NewsList,
    meta: {
      title: '新闻列表'
    }
  },
  {
    path: '/home/newsinfo/:id',
    component: NewsInfo,
    props: true,
    meta: {
      title: '新闻详情'
    }
  }
]

const router = new VueRouter({
  routes
})

export default router
